﻿/*----------------------------------------------------------------
//  <copyright file="WeChatOptions.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-12-06 08:36</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Authentication.OAuth2.WeChat
{
    #region "微信认证选项"
    /// <summary>
    /// 微信认证选项
    /// </summary>
    public class WeChatOptions : OAuthOptions
    {
        #region "属性"
        #region "获取或设置 微信认证 AppId"
        /// <summary>
        /// 获取或设置 微信认证 AppId 
        /// </summary>
        public string AppId
        {
            get { return ClientId; }
            set { ClientId = value; }
        }
        #endregion
        #region "获取或设置 微信认证 AppKey"
        /// <summary>
        /// 获取或设置 微信认证 AppKey
        /// </summary>
        public string AppKey
        {
            get { return ClientSecret; }
            set { ClientSecret = value; }
        }
        #endregion

        #region "获取或设置 刷新或续期access_token使用的终结点"
        /// <summary>
        /// 获取或设置 刷新或续期access_token使用的终结点
        /// </summary>
        public string RefreshTokenEndpoint { get; set; }
        #endregion
        #region "获取或设置 检查access_token有效性的终结点"
        /// <summary>
        /// 获取或设置 检查access_token有效性的终结点
        /// </summary>
        public string CheckAuthEndpoint { get; set; }
        #endregion

        #endregion

        #region "构造函数"
        #region "初始化一个微信认证选项的新实例"
        /// <summary>
        /// 初始化一个微信认证选项 <see cref="WeChatOptions"/> 的新实例
        /// </summary>
        public WeChatOptions()
        {
            ClaimsIssuer = WeChatDefaults.Issuer;
            CallbackPath = new PathString(WeChatDefaults.CallbackPath);

            AuthorizationEndpoint = WeChatDefaults.AuthorizationEndpoint;
            TokenEndpoint = WeChatDefaults.TokenEndpoint;
            UserInformationEndpoint = WeChatDefaults.UserInformationEndpoint;
            RefreshTokenEndpoint = WeChatDefaults.RefreshTokenEndpoint;
            CheckAuthEndpoint = WeChatDefaults.CheckAuthEndpoint;

            //Scope 表示用户授权时向用户显示的可进行授权的列表。
            Scope.Add(WeChatDefaults.snsapi_base);
            Scope.Add(WeChatDefaults.snsapi_login);
            Scope.Add(WeChatDefaults.snsapi_userinfo);

            //ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "unionid");
            //ClaimActions.MapJsonKey(ClaimTypeConstants.OpenIdEx, "openid");
            //ClaimActions.MapJsonKey(ClaimTypeConstants.HeadImgEx, "headimgurl");
            //ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
            //ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex");
            //ClaimActions.MapJsonKey(ClaimTypes.StateOrProvince, "province");
            //ClaimActions.MapJsonKey("urn:weixin:city", "city");
            //ClaimActions.MapJsonKey(ClaimTypes.Country, "country");

        }
        #endregion

        #endregion

    }
    #endregion

}
